/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package CreateTable;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author tashiba
 */
public class CreateTableKK {
    public static void main(String[] args) {

        try {
            try {
                Class.forName("com.mysql.jdbc.Driver");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(CreateTableUser.class.getName()).log(Level.SEVERE, null, ex);
            }
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/pti", "root", "115314034");


            System.out.println("Koneksi is OK");
            Statement statement = conn.createStatement();
            String KK = " CREATE TABLE KK(NOKK INT(11) NOT NULL,"
                    + "NAMAKK VARCHAR(100),ALAMAT VARCHAR(100),"
                    + "CONSTRAINT KK_PK PRIMARY KEY(NOKK));";

            statement.executeUpdate(KK);
            System.out.println("Tabel KK Created");
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
    }
}
